package com.apimarket.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

//sys_user_role用户有哪些角色
@Repository
public interface SysUserRoleMapper {
    //基于角色id删除角色菜单关系
    int deleteObjectsByRoleId(Integer roleId);

    int insertObjects(
            @Param("userId")Integer userId,
            @Param("roleIds")Integer[] roleIds);

    int deleteObjectsByUserId(Integer userId);


    //基于用户id查找用户对应的角色id
    @Select("select role_id from sys_user_roles where user_id=#{id}")
    List<Integer> findRoleIdsByUserId(Integer id);
}
